<template>
  <a-modal popup-container=".page-container" @cancel="close" :width="660" title="分期账单" :visible="visible">
    <template #footer>
      <a-button @click="close">关闭</a-button>
      <a-button type="primary" @click="handleOkFn" :loading="loading">确认</a-button>
    </template>
  </a-modal>
</template>

<script setup>
  import { ref } from 'vue'
  import { findPayableListById } from '@/api/asset/car'

  const visible = ref(false)
  const loading = ref(false)
  const open = () => {
    visible.value = true
    payablePreviewFn(id)
  }
  const close = () => {
    visible.value = false
  }
  const handleOkFn = () => {
    console.log('保存')
  }
  // 获取账单详情
  const payablePreviewData = ref(null)
  const payablePreviewFn = (id) => {
    findPayableListById({ id: id }).then((res) => {
      payablePreviewData.value = res.result
      console.log(payablePreviewData)
    })
  }

  defineExpose({
    open,
  })
</script>
